<?php
header('Content-type: text/json;charset=utf-8');
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

session_start();

require __DIR__ . '/../vendor/autoload.php';

$config = require __DIR__ . '/../config/app.php';
$database = require __DIR__ . '/../config/database.php';

$app = new \Slim\App($config);

$container = $app->getContainer();

$container['database'] = function () use ($database){
    return $database;
};

$app->get('/', function (Request $request, Response $response) {
    $data = $this->database->info();

    return $response->write(json_encode($data));
});